package com.fxu.tpl.enums;

import com.fxu.framework.core.enums.BaseEnum;
import lombok.AllArgsConstructor;

/***
 * 测试类型
 * @author fangxu
 * @version 2021-09-07
 ***/
@AllArgsConstructor
public enum TestTypeEnum implements BaseEnum<Integer, String> {
    HOME(1, "首页邮箱"),
    DETAIL(2, "详细信息");

    final Integer code;
    final String desc;

    @Override
    public Integer code() {
        return code;
    }

    @Override
    public String desc() {
        return desc;
    }

    public static String desc(Integer code) {
        TestTypeEnum ret = find(code);
        return ret == null ? null : ret.desc;
    }

    public static TestTypeEnum find(Integer code) {
        return code == null ? null : BaseEnum.findOne(values(), v -> v.code.equals(code));
    }
}